<template>
	<view>
		<view>
			<u-subsection :list="list" :current="curNow" @change="sectionChange"></u-subsection>
		</view>


		<view style="clear:both" v-for="(item, index) in minelist" :key="item.mid" :ref="'item'+index"
			@click="onclick(item)">
			<uni-card :title="item.name">

				<view
					style="background-color: #6c76f4; width: 60px;border-radius:5px;float: left;margin: -45px 0px 30px 120px;">
					<view v-if="item.status ==1">
						<text style="color: #fff;margin-left: 10px;">
							待参加
						</text>
					</view>

					<view v-if="item.status ==2">
						<text style="color: #fff;margin-left: 10px;">
							进行中
						</text>
					</view>

					<view v-if="item.status ==3">
						<text style="color: #fff;margin-left: 10px;">
							已结束
						</text>
					</view>
				</view>

				<view style="clear:both">
					<!-- <u-icon name="map-fill"></u-icon>	 -->
					<text class="uni-body text1">会议室地址：</text>
					<text class="uni-body text2">{{item.meetingaddress}}</text>


				</view>
				<view>
					<text class="uni-body text1">开始时间：</text>
					<text class="uni-body text2">{{item.starTime}}</text>
				</view>
				<view>
					<text class="uni-body text1">结束时间：</text>
					<text class="uni-body text2">{{item.endTime}}</text>
				</view>

			</uni-card>
		</view>
		
		<view>
			<u-button @click="add()" class="button1" type="success" shape="circle">
				添加会议
			</u-button>
		</view>
		
	</view>
</template>

<script>
	export default {
		// onLoad: function(option) {
		// 	console.log("接收到的参数" + option.cid);
		// 	this.conference.cid = option.cid

		// },
		data() {
			return {
				mine: {
					status: 1,
				},
				minelist: null,
				list: ['待参加', '进行中', '已结束'],
				curNow: 0,
				user:{}
			}
		},
		created() {
			this.user = uni.getStorageSync('user')
			this.findAll();
		},
		methods: {
			sectionChange(index) {
				this.curNow = index;
				console.log(this.curNow)
				if (this.curNow == 0) {
					this.mine.status = 1
				}
				if (this.curNow == 1) {
					this.mine.status = 2
				}
				if (this.curNow == 2) {
					this.mine.status = 3
				}
				this.findAll()
			},
			findAll() {
				// console.log("接收到的参数" + this.conference.cid);
				uni.request({
					url: "http://localhost:8007/conference/mine/findAll/" + this.mine.status,
					method: 'get',
					success: (res) => {
						console.log(res)
						this.minelist = res.data.data.list
						// console.log(res.data.data.c)
					}
				})
			},
			onclick(e) {
				uni.navigateTo({
					url: "./mydetails?mid=" + e.mid,
				})
			},
			add(){
				// console.log("接收到的参数" + this.conference.cid);
				uni.request({
					url: "http://localhost:8007/conference/mine/addMine",
					method: 'post',
					data:{
						name:"销售部列会",
						meetingenter:"1",
						status:"1",
						userid:this.user.eid
					},
					success: (res) => {
						uni.navigateTo({
							url: "./addmine?mid=" + res.data.data.mid,
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.button1 {
		width: 90%;
		margin-left: 20px;
		background: #2979ff;
		border-radius: 10px;
		border-color: #2979ff;
	}
</style>
